package tool.code.generater.util;

/**
 * @author zhoup
 * @since 2025/8/18
 */
public class StrKit {
    public static String firstCharToUpperCase(String str) {
        return str.substring(0, 1).toUpperCase() + str.substring(1);
    }

    public static String toCamelCase(String str) {
        String[] split = str.split("_");
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < split.length; i++) {
            if (i == 0) {
                result.append(split[i]);
            } else {
                result.append(firstCharToUpperCase(split[i]));
            }
        }
        return result.toString();
    }
    public static String computePackage(String basePackage, String module) {
        if (module == null || module.isEmpty()) {
            return basePackage;
        }
        return basePackage + "." + module;
    }
}
